package com.lagou.test;


import com.lagou.domain.Article;
import com.lagou.service.ArticleService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class tset1 {

    @Autowired
    private ArticleService articleService;


    @Test
    public void testFindAll(){
        List<Article> list = articleService.findAll();
        for (Article article : list) {
            System.out.println(article);
        }
    }

    @Test
    public void save(){
        Article article = new Article();
        article.setId(8);
        article.setTitle("cesh12i4547");
        article.setContent("ceshi24542123233");
        articleService.save(article);
    }
}
